<template>
  <div>
    <upload-oss
      multiple
      ref="upload"
      dir="upload/test1"
      :file-list="fileList"
      :show-file-list="true"
    ></upload-oss>
    <div>
      <el-button type="primary" @click="onUpload" :loading="loading">上传</el-button>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  props: {},
  data() {
    return {
      loading: false,
      fileList: [],
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    async onUpload() {
      try {
        this.loading = true
        const res = await this.$refs.upload.submit()
        console.log(res) // eslint-disable-line no-console
      } catch (error) {
        this.$message(error && error.message)
      } finally {
        this.loading = false
      }
    },
  },
}
</script>

<style lang="scss" scoped></style>
